{% extends 'wagtailadmin/bulk_actions/confirmation/base.html' %}
{% load wagtailadmin_tags i18n %}
{% block titletag %}{% blocktrans trimmed count counter=items|length %}Delete 1 document {% plural %}Delete {{ counter }} documents{% endblocktrans %}{% endblock %}

{% block header %}
    {% trans "Delete documents" as del_str %}
    {% include "wagtailadmin/shared/header.html" with title=del_str icon="doc-full-inverse" %}
{% endblock header %}

{% block items_with_access %}
    {% if items %}
        <p>
            {% blocktrans trimmed count counter=items|length %}
                Are you sure you want to delete this document?
            {% plural %}
                Are you sure you want to delete these documents?
            {% endblocktrans %}
        </p>
        <ul>
            {% for document in items %}
                <li>
                    <a href="{% url 'wagtaildocs:edit' document.item.id %}"  target="_blank" rel="noreferrer">{{document.item.title}}</a>
                    {% usage_count_enabled as uc_enabled %}
                    {% if uc_enabled %}
                        (<a href="{{ document.item.usage_url }}">{% blocktrans trimmed count usage_count=document.item.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>)
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    {% endif %}
{% endblock items_with_access %}

{% block items_with_no_access %}

    {% blocktrans trimmed asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to delete this document{% plural %}You don't have permission to delete these documents{% endblocktrans %}
    {% include 'wagtaildocs/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}

{% endblock items_with_no_access %}

{% block form_section %}
    {% if items %}
        {% trans 'Yes, delete' as action_button_text %}
        {% trans "No, don't delete" as no_action_button_text %}
        {% include 'wagtailadmin/bulk_actions/confirmation/form.html' with action_button_class="serious" %}
    {% else %}
        {% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
    {% endif %}
{% endblock form_section %}
